#include <stdio.h>
#include <stdlib.h>
#include "tree.h"

/*将树向左倒，画出树的形状
 *@level:表示树的层级
 *@0:表示从树的第零层开始
 *先打印右子树，再打印根，最后打印左子树
 */

static void tree_draw_(tree_st *ptr,int level)
{
	if(NULL == ptr)
		return ;
	tree_draw_(ptr->rchild,level+1);
	for(int i = 0;i < level;i++)
	{
		printf("    ");
	}
	printf("%c\n",ptr->data);
	tree_draw_(ptr->lchild,level+1);
}

	void tree_draw(tree_st *ptr)
{
	tree_draw_(ptr,0);
}
